package lab02.test30;

import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Test30 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        List<Float> score = new ArrayList<Float>();//集合实例化ArrayList
        int cout = 0;
        //用循环向score集合中添加数据。
        for (int i = 0; i < 10; i++){
            cout += 1;
            System.out.println("请输入第" + cout + "个同学的成绩：");
            score.add(scanner.nextFloat());
        }
        float sum = 0;
        //求成绩总和。
        for (Float n : score){
            sum += n;
        }
        System.out.println("平均成绩为：" + sum / score.size());
    }
}
